<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/static/jquery-1.11.3.min.js"></script>
    <script>
        $(function () {
           $('#login').click(function () {
               var u = $('#username').val()
               var p = $('#password').val()

               $.post("/loginJson.do",{username:u,password:p},function (data) {
                   console.log(data);
                   $('#result').html(data.msg)
                       .css("color",data.success ? 'green' :'red');
               })
           })
        })
    </script>
</head>

<body>
    <span id="result"></span>
    <input type="text" id="username" placeholder="用户名">
    <input type="text" id="password" placeholder="密码">
    <button id="login">登录</button>
</body>
</html>